home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sun Solutions 2000 #2
/
Sun Solutions CD (Volume 2 2000)(Special Focus - Java Technologies)(Disc 1).ISO
/
products
/
Software
/
TornadoLabsLimited
/
book
/
KeyNavigateTest
/
Light.java
< prev
next >
Wrap
Text File
|
2000-01-13
|
2KB
|
56 lines
/*
//*****************************************************************************
/*
* @(#) Light.java
*
* Project: Java 3D Programming
* Client: Manning Publications
*
* Copyright (c) 1999 Daniel Selman
* All Rights Reserved.
*
* @author Daniel Selman: dselman@tornadolabs.com
*/
//*****************************************************************************
import javax.vecmath.*;
import javax.media.j3d.*;
import java.awt.*;
import java.net.*;
import com.sun.j3d.utils.image.*;
import com.sun.j3d.utils.geometry.*;
import com.tornadolabs.dselman.j3d.book.*;
public class Light extends ComplexObject
{
private TextureAttributes m_TextureAttributes = null;
public Light( Component comp, Group g, int nFlags )
{
super( comp, g, nFlags );
}
protected Group createGeometryGroup( Appearance app, Vector3d position, Vector3d scale, String szTextureFile, String szSoundFile )
{
Group g = new Group();
app.setPolygonAttributes( new PolygonAttributes( PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_NONE, 0, false ) );
app.setTransparencyAttributes( new TransparencyAttributes( TransparencyAttributes.BLENDED, 1.0f ) );
m_TextureAttributes = new TextureAttributes( TextureAttributes.REPLACE, new Transform3D(), new Color4f(0,0,0,1), TextureAttributes.FASTEST );
app.setTextureAttributes( m_TextureAttributes );
if( (m_nFlags & ComplexObject.TEXTURE) == ComplexObject.TEXTURE )
setTexture( app, szTextureFile );
Cone cone = new Cone( 1, 1, Primitive.GENERATE_TEXTURE_COORDS, app );
g.addChild( cone );
attachBehavior( new TextureAnimationBehavior( m_TextureAttributes ) );
return g;
}
}